package com.oneonefive.educationsystem.config;

import com.oneonefive.educationsystem.mapper.SemesterMapper;
import com.oneonefive.educationsystem.utils.Constant;
import jakarta.annotation.Resource;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class StartInitConfig implements ApplicationListener<ApplicationReadyEvent> {
    @Resource
    SemesterMapper semesterMapper;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        Constant.SEMESTER = semesterMapper.getCurSemester();
        System.out.println("服务器初始化完成");
    }
}
